package com.coding365.service.code.controller;

import com.coding365.service.code.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class CodeController {

    @Autowired
    private CodeService codeService;

    @GetMapping("/create/{email}")
    public Boolean create(@PathVariable String email){
        return codeService.create(email);
    }

    @GetMapping("/validate/{email}/{code}")
    public Integer validate(@PathVariable String email,@PathVariable String code){
        return codeService.validate(email,code);
    }

}
